@extends('admin.layout')

@section('content')
<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                分类管理
                <small>添加</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>分类管理</a></li>
                <li><a href="#">主页</a></li>
                <li class="active">添加</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-default">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速添加</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/cate/insert') }}" enctype="multipart/form-data" method="post">
                        {{csrf_field()}}
                            <div class="box-body">
                                @if($errors->any())
                                    <div class="callout callout-info">
                                    <h4>警告</h4>
                                    @foreach($errors->all() as $error)
                                        <p>{{ $error }}</p>
                                    @endforeach
                                  </div>    
                                @endif
                                 
                                <div class="form-group">
                                    <label for="exampleInputEmail1">父分类名</label>
                                    <select name='pid' class="form-control">
                                        <option value="0">根分类</option>
                                        @foreach($data as $k => $v)
                                        <option value="{{ $v -> id}}">{{$v -> name}}</option>
                                        @endforeach
                                        </select>
                               

                                </div><!-- /.box-body -->
                                <div class="form-group">
                                    <label for="exampleInputEmail1">分类名</label>
                                    <input type="text" name="name" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入类名" value="{{old('name')}}">
                                </div>   
                                <div class="form-group">
                                    <label for="exampleInputEmail1">简介</label>
                                    <input type="text" name="content" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入简单介绍" value="{{old('name')}}">
                                </div>
                               
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">添加</button>
                            </div>
                        </form>
                    </div><!-- /.box -->

                </div><!--/.col (left) -->
               
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection 